Skip to content

feat: Support OIDC Provider OIDC Clients#2147

Open
bigkevmcd wants to merge 2 commits into
rancher:mainfrom
bigkevmcd:support-oidcclients
Open

feat: Support OIDC Provider OIDC Clients#2147
bigkevmcd wants to merge 2 commits into
rancher:mainfrom
bigkevmcd:support-oidcclients

Conversation

@bigkevmcd
Copy link
Copy Markdown
Contributor

@bigkevmcd bigkevmcd commented Apr 21, 2026

Addresses #2156 and rancher/rancher#53639

Description

Adds support for CRUDding OIDCClients

Testing

Not a breaking change.

@bigkevmcd bigkevmcd marked this pull request as ready for review April 24, 2026 14:30
Copilot AI review requested due to automatic review settings April 24, 2026 14:30
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch 2 times, most recently from 8c8fa7f to 7e15537 Compare April 24, 2026 14:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Terraform resource to manage Rancher OIDC clients (CRUD) and registers it with the provider.

Changes:

  • Introduces rancher2_oidc_client resource implementation (schema + CRUD).
  • Adds unit tests for expand/flatten helpers.
  • Registers the new resource in Provider() resources map.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 11 comments.

File Description
rancher2/resource_rancher2_oidc_client.go New OIDC client resource schema + CRUD + expand/flatten helpers.
rancher2/resource_rancher2_oidc_client_test.go Unit tests for expand/flatten behavior.
rancher2/provider.go Registers the new rancher2_oidc_client resource.

Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread rancher2/resource_rancher2_oidc_client_test.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
@bigkevmcd bigkevmcd marked this pull request as draft April 24, 2026 14:56
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch from 7b87e5c to 4d388e7 Compare May 6, 2026 14:53
@bigkevmcd bigkevmcd requested a review from Copilot May 7, 2026 14:14
@bigkevmcd bigkevmcd marked this pull request as ready for review May 7, 2026 14:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
@bigkevmcd bigkevmcd marked this pull request as draft May 7, 2026 14:20
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch from 4d388e7 to dee3e92 Compare May 8, 2026 09:14
@bigkevmcd bigkevmcd requested a review from Copilot May 8, 2026 09:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread rancher2/resource_rancher2_oidc_client_test.go
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread rancher2/resource_rancher2_oidc_client_test.go
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch 2 times, most recently from 367aae4 to ed00cc1 Compare May 8, 2026 13:08
@bigkevmcd bigkevmcd requested a review from Copilot May 8, 2026 14:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread docs/resources/oidc_client.md
Comment thread rancher2/resource_rancher2_oidc_client_test.go
Copilot AI review requested due to automatic review settings May 11, 2026 12:42
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch from fb5d2b4 to 52dff94 Compare May 11, 2026 12:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comment thread rancher2/resource_rancher2_oidc_client.go
Comment thread docs/resources/oidc_client.md
Comment thread docs/resources/oidc_client.md
@matttrach matttrach added the release/v15 Targets release v15.x correlating to Rancher's v2.15.x label May 11, 2026
Copy link
Copy Markdown
Contributor

@JonCrowther JonCrowther left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with just one nit related to the logging

Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Copilot AI review requested due to automatic review settings May 18, 2026 09:52
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Comment thread rancher2/resource_rancher2_oidc_client.go Outdated
Comment thread docs/resources/oidc_client.md
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch from 140e5f0 to 493535e Compare May 18, 2026 11:03
@bigkevmcd bigkevmcd requested a review from JonCrowther May 19, 2026 06:20
This adds support for the OIDC Provider OIDCClient resource.
Copilot AI review requested due to automatic review settings May 19, 2026 10:13
@bigkevmcd bigkevmcd force-pushed the support-oidcclients branch from 493535e to 5367660 Compare May 19, 2026 10:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread docs/resources/oidc_client.md
# rancher2\_oidc_client Resource

Provides a Rancher OIDC Client. This can be used to configure the OIDC Clients
available for the Rancher OIDC Provider.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably an auto-wrap for line length

Suggested change
available for the Rancher OIDC Provider.
Provides a Rancher OIDC Client. This can be used to configure the OIDC Clients available for the Rancher OIDC Provider.

Comment on lines +12 to +16
### Creating a Rancher OIDC Client.

```hcl
resource "rancher2_oidc_client" "oidc-test-client" {
description = "Access for Test Client"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should adhere to the same structure/conventions: https://registry.terraform.io/providers/rancher/rancher2/latest/docs/resources/user#example-usage

Suggested change
### Creating a Rancher OIDC Client.
```hcl
resource "rancher2_oidc_client" "oidc-test-client" {
description = "Access for Test Client"
```hcl
# Create a new rancher2 OIDC Client
resource "rancher2_oidc_client" "foo" {
description = "Foo OIDC Client"

Comment on lines +31 to +34
* `description` - A human-readable description for the OIDC Client.
* `token_expiration_seconds` - ID Token and Access Token will only be valid for this many seconds.
* `refresh_token_expiration_seconds` - How long can the refresh token be used for?
* `redirect_uris` - Provides a list of allowed redirect URIs for this OIDC Client.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's clearer to put before the required args, also specifying if they are required/optional?

Suggested change
* `description` - A human-readable description for the OIDC Client.
* `token_expiration_seconds` - ID Token and Access Token will only be valid for this many seconds.
* `refresh_token_expiration_seconds` - How long can the refresh token be used for?
* `redirect_uris` - Provides a list of allowed redirect URIs for this OIDC Client.
* `redirect_uris` - (Required) List of allowed redirect URIs for this OIDC Client (list)
* `description` - (Optional) A human-readable description for the OIDC Client (string)
* `token_expiration_seconds` - (Optional/Computed) ID Token and Access Token will only be valid for this many seconds (int)
* `refresh_token_expiration_seconds` - (Optional/Computed) How long can the refresh token be used for (int)

OIDC Clients can be imported using the Client name in the format `<client_name>`

```
$ terraform import rancher2_oidc_client.foo &lt;CLIENT_NAME&gt;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ terraform import rancher2_oidc_client.foo &lt;CLIENT_NAME&gt;
$ terraform import rancher2_oidc_client.foo <client_name>

Copy link
Copy Markdown

@enrichman enrichman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some comments related to the docs, but LGTM 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release/v15 Targets release v15.x correlating to Rancher's v2.15.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants